// holds information for a particular piece of the grid
// which is being explored by A*

#ifndef NODE_H
#define NODE_H

#include "Utilities.h"

class Node
{

public:
	// total cost to square and then dest
	int f;
	// cost to get to square
	int g;
	// heuristic to dest
	int h;
	// current node which leads most quickly to this one
	Node * parent;
	// used to maintain the open list
	Node * prev, * next;
	// tells whether the current node is on the open list
	bool open;
	// initial value for distances
	static const int INFINITY;

	Position position;
	Node();
	Node( Position pos, int _g = 0, int _h = 0, Node * par = 0 );
	Node( const Node & n );
	~Node();

	Node * close();
	void push( Node * next );

	bool operator>( const Node & rh ) const;
	bool operator<( const Node & rh ) const;
};

#endif